<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>菜单管理</title>
		<link rel="stylesheet" href="../css/common.css" type="text/css" />
		<link href="http://static.mttang.com/css/Public.css" rel="stylesheet" type="text/css" />
            <link href="http://static.mttang.com/css/recharge.css" rel="stylesheet" type="text/css" />
            <link type="text/css" rel="stylesheet" href="http://static.mttang.com/css/validator.css"></link>
            <script type="text/javascript" src="http://static.mttang.com/js/jquery-1.4.2.min.js"></script>
            <script src="http://static.mttang.com/js/formValidator.js" type="text/javascript" charset="UTF-8"></script>
            <script src="http://static.mttang.com/js/formValidatorRegex.js" type="text/javascript" charset="UTF-8"></script>
		<script>
		   $(document).ready(function(){
				$.formValidator.initConfig({formid:"form1",onerror:function(msg){alert(msg)},onsuccess:function(){return true;}});
				$('#menuName').formValidator({onshow:"请输入菜单名称",oncorrect:"输入正确",empty:false,onfocus:"菜单名称不能为空",tipid:"menuNameTip"})
				.inputValidator({type:"size",min:"1",max:"20",onerror:"菜单名称长度不正确"});
				$('#menuUrl').formValidator({onshow:"请输入URL",oncorrect:"输入正确",empty:false,onfocus:"URL不能为空",tipid:"menuUrlTip"})
				.inputValidator({type:"size",min:"1",max:"255",onerror:"确认URL长度不正确"});
				$('#showlevel').formValidator({onshow:"请输入显示等级必须是正整数",empty:false,onfocus:"显示等级不能为空",tipid:"showlevelTip"})
				.inputValidator({max:"3",min:"1",empty:false,onerror:"长度不正确"}).regexValidator({regexp:"num1",datatype:"enum",onerror:"无效字符"});
			});	
		</script>
	</head>
	<body>
		<div id="man_zone">
                    <center><c:out value="${bean.message}" /></center>
		<form action="menu.do?method=add" method="post" id="form1" >
		 <table class="table_style" border="0" align="center"  cellpadding="3" cellspacing="1">
		   	<tr>
		   	 <td class="left_title_1">菜单名称:</td>
		   		<td>
		   		<input type="text" id="menuName" name="menuName" value="<c:out value='${bean.menuName}'/>"/>
		   		</td>
		   		<td class="text_tip"><div id="menuNameTip"></div></td>   	
		   	</tr>
		   	<tr>
		   	<td class="left_title_2">菜单地址:</td>
		   		<td>
		   		<input type="text"  id="menuUrl" name="menuUrl" value="<c:out value='${bean.menuUrl}'/>"/>
		   		</td>
		   		<td><div id="menuUrlTip"></div></td>   	
		   	</tr>
		   	<tr>
		   	<td class="left_title_1">显示等级:</td>
		   		<td>
		   		<input type="text"  id="showlevel"  name="showlevel" value="<c:out value='${bean.showlevel}'/>"/>
		   		</td>
		   		<td><div id="showlevelTip"></div></td>   	
		   	</tr>
		   	<tr>
		   	<td class="left_title_2">父级菜单:</td>
		   		<td>
		   		<input type="text" name="menu_pname"  value="<c:out value='${bean.menu.menuName}'/>"  readonly="readonly" />
		   		<input type="hidden" id="menuPid" name="menuPid" value="<c:out value='${bean.menuPid}'/>"  readonly="readonly" />
		   		</td>
		   		<td></td>
		   	</tr>		
        <tr>   	
        <td class="left_title_1">具体权限:</td>
		   	<td>
		   	<table class="table_style" border="0" align="center" cellspacing="1">
        	<c:if test="${bean.prvlist != null}">
        		<c:forEach items="${bean.prvlist}" var="menu" varStatus="status">
        		<c:if test="${status.index%4==0}"><tr></c:if>
        		<td>
        			<input  type="checkbox"  name="menu_prv"   value="<c:out value="-1,${menu.prvId}"/>"  /><c:out value="${menu.name}"/>
        		</td>
        		<c:if test="${status.count%4==0}"></tr><tr></c:if>
        		</c:forEach>
        	</c:if>
        	</table>
        </td>
        <td></td>
        </tr>
		  </table>
		  <table class="table_style" border="0" align="center"  cellpadding="3" cellspacing="1">
       <tr>
         <td>
         <input type="hidden" name="prv" value="insert" />
          <input type="submit" value="提交" />
          <span class="sub_sp">&nbsp;</span>
          <input type="reset" value="重置" />
         </td>
       </tr>
	</table>
		</form>
		</div>
	</body>
</html>